package exhandler;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SimpleExHandler implements HandlerExceptionResolver {
    @Override
    public ModelAndView resolveException(HttpServletRequest httpServletRequest
            , HttpServletResponse httpServletResponse, Object o, Exception e) {

        String strMessage = e.getMessage();
        System.out.println(strMessage);

        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("showNowTime");
        modelAndView.addObject("time", System.currentTimeMillis());
        return modelAndView;
    }
}
